package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 押金预警
 * </p>
 *
 * @author linan
 * @date 2023-02-17
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "DepositWarningWarningStandardEnum", description = "预警标准 #{SIMPLE_SERVICE_AMOUNT:单项服务金额;TOTAL_SERVICE_AMOUNT:总服务金额;-枚举")
public enum DepositWarningWarningStandardEnum implements BaseEnum {

    /**
     * SIMPLE_SERVICE_AMOUNT="单项服务金额"
     */
    SIMPLE_SERVICE_AMOUNT("单项服务金额"),
    /**
     * TOTAL_SERVICE_AMOUNT="总服务金额"
     */
    TOTAL_SERVICE_AMOUNT("总服务金额"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static DepositWarningWarningStandardEnum match(String val, DepositWarningWarningStandardEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static DepositWarningWarningStandardEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(DepositWarningWarningStandardEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "SIMPLE_SERVICE_AMOUNT,TOTAL_SERVICE_AMOUNT", example = "SIMPLE_SERVICE_AMOUNT")
    public String getCode() {
        return this.name();
    }

}
